<template>
    <div style="width: 1000px;">
        <div class="flex_b">
            <div class="flex">
				<el-input v-model="code" size="mini" 
					placeholder="请输入串号"
					style="margin-right: 10px;"></el-input>
                <el-button type="primary" @click="search" size="mini">检索</el-button>
				<el-button @click="clearSearch" size="mini">重置/检索</el-button>
            </div>
        </div>
		<br>
        <el-table  :data="result"   border  style="width: 100%" >
			<el-table-column  label="序号" width="100"  align="center">
				<template slot-scope="scope">
				   <div>
					   {{scope.$index+1}}
				   </div>
				</template>
			</el-table-column>
            <el-table-column   align="center"    prop="goods_name"    label="商品名称"></el-table-column>
            <el-table-column  align="center"   prop="add_time"  label="发生日期"></el-table-column>
			<el-table-column  align="center"   prop="supplier"  label="供应商"></el-table-column>
			<el-table-column  align="center"   prop="customer"  label="客户"></el-table-column>
			<el-table-column  align="center"   prop="code"  label="串号"></el-table-column>
			
			<el-table-column  label="状态"  align="center">
				<template slot-scope="scope">
				   <el-select v-model="scope.row.status"
						@change="changeData(scope.row)"
						size="mini"
						placeholder="请选择">
				       <el-option
				         v-for="item in options"
				         :key="item.value"
				         :label="item.label"
				         :value="item.value">
				       </el-option>
				     </el-select>
				</template>
				
			</el-table-column>
           
        </el-table>
	   
	   
	   
    </div>
</template>
<style>

</style>
<script>
	
    export default {
		
        data(){
            return {
				code:"",
                result:[],
				options:[
					{
						value: '0',
						label: '采购退货'
					},
					{
						value: '1',
						label: '采购入库'
					},
					{
						value: '2',
						label: '批发'
					},
					{
						value: '3',
						label: '批发退货'
					}
				]
            }
        },
        mounted(){
			
            document.title='串号状态调整'
        },
        methods:{
			changeData(row){
				let params = {
					status:row.status,
					id:row.id
				}
				this.$post('/system/updateCodeStatus',params,res=>{
					 if(res.data.code==200){
						 this.$message.success('操作成功')
					 }
				})
			},
			clearSearch(){
				this.code = ''
				this.list = []
			},
            lodeList(){
				if(!this.code) return this.$message.error('请输入串号')
                this.$post('/system/getCodeStatus',{code:this.code},res=>{
                	 let result = res.data
                	if(result.code == 200){
						this.result = result.data
                	}
                })
            },
            
        }
    }
</script>
